package com.daodway.designpattern.singletonpattern;

import org.junit.Test;

public class Client {
	@Test
	public  void main(){
		SingletonHungry singHungry1 = SingletonHungry.getInstance();
		singHungry1.setName("SingHungry");
		
		SingletonHungry singHungry2 = SingletonHungry.getInstance();
		singHungry2.setName("饿汉式单例2");
		
		System.out.println("实列名:"+singHungry1.getName());
		System.out.println("实列名:"+singHungry2.getName());
		
		if(singHungry1==singHungry2){
			System.out.println("创建的是同一个对象");
		}else{
			System.out.println("不是同一个对象");
			
		}
	}
	
}
